import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';

import '../../common/images_url.dart';

///搜索到的设备卡片

class ScanDeviceItem extends StatelessWidget {
  final String imgSrc;
  final String name;
  final String id;
  final DiscoveredDevice? device;

  const ScanDeviceItem({super.key, required this.imgSrc, required this.device,required this.name,required this.id});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        // 边框线宽、颜色
        border: Border.all(width: 1.0, color: const Color.fromARGB(255, 145, 145, 145)),
        //阴影
        boxShadow: const [
          BoxShadow(color: Colors.grey, offset: Offset(0, 0), blurRadius: 0, spreadRadius: 0),
        ],
        color: const Color.fromARGB(255, 255, 251, 255),
        //圆角半径
        borderRadius: const BorderRadius.all(Radius.circular(12.0)),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          //手表图标
          Image.asset(imgSrc,fit: BoxFit.scaleDown,height: 80,),
          const SizedBox(height: 4),
          //设备名称
          Text(name, maxLines: 1, overflow: TextOverflow.clip),
          const SizedBox(height: 2),
          //设备MAC
          Text(
            id,
            maxLines: 1,
            overflow: TextOverflow.clip,
            style: const TextStyle(color: Color.fromARGB(255, 125, 125, 125), fontSize: 11),
          )
        ],
      ),
    );
  }
}
